import { createBrowserRouter, RouterProvider } from 'react-router-dom';
import App from '../App';
import Home from '../pages/Home';
import LevelSelect from '../pages/LevelSelect';
import GameBattle from '../pages/GameBattle';
import Settings from '../pages/Settings';

// 创建路由配置
const router = createBrowserRouter([
  {
    path: '/',
    element: <App />,
    children: [
      {
        index: true,
        element: <Home />
      },
      {
        path: 'levels',
        element: <LevelSelect />
      },
      {
        path: 'game/:mode/:level',
        element: <GameBattle />
      },
      {
        path: 'settings',
        element: <Settings />
      }
    ]
  }
]);

// 路由提供者组件
export function AppRouter() {
  return <RouterProvider router={router} />;
}

export default router;